#!/bin/sh
# parameter 1: work directory
# parameter 2: master-addr port
# parameter 3: config file for DM-master

set -eu

workdir=$1
port=$2
conf=$3

PWD=$(pwd)
binary=$PWD/bin/dm-master.test

mkdir -p $workdir/log

echo "[$(date)] <<<<<< START DM-MASTER on port $port, config: $conf >>>>>>"
cd $workdir
$binary -test.coverprofile="$TEST_DIR/cov.$TEST_NAME.master.out" DEVEL \
    --master-addr=:$port --log-file="$workdir/log/dm-master.log" \
    --config="$conf" > $workdir/log/stdout.log 2>&1 &
cd $PWD
